<template>
    <div>
        <el-card class="box-card" shadow="never">
            <i class="el-icon-search"></i>
            <span>筛选搜索</span>
            <el-row :gutter="10" style="margin-top:15px;">
               <el-col :span='6'>
                  <el-input v-model="lt_bar_code">
                    <template slot="prepend">轮胎编码</template>
                  </el-input>
               </el-col>
            </el-row>
            <el-row :gutter="20" class="yx_el_row">
                <el-col :span="4">
                    <el-button type="success" plain @click="search">筛选</el-button>
                </el-col>
            </el-row>
            <div class="yx_line"></div>
            <div style="margin-top:10px;">
              <i class="el-icon-tickets"></i>
              <span>数据列表</span>
            </div>
            <el-table class="yx_table" border :data="loglist">
                <el-table-column type="index" label="序号" width="80">
                </el-table-column>
                <el-table-column prop="account_name" label="操作人" width="200">
                </el-table-column>
                <el-table-column prop="lt_bar_code" label="关联轮胎条码" width="150">
                </el-table-column>
                <el-table-column prop="content" label="日志内容" width="800">
                </el-table-column>
                <el-table-column prop="created_at" label="创建时间">
                </el-table-column>
            </el-table>
            <Pagination :total_count="total_count" :getList="getList"></Pagination>
        </el-card>
    </div>
</template>

<script>
    import { getLogList } from '@/api/log.js';
    import Pagination from '@/components/Pagination.vue';
    export default {
        name: 'LogList',
        components:{ Pagination },
        inject:['reload'],
        data() {
            return {
                loglist:[],
                total_count:0,
                lt_bar_code:'',
            }
        },
        methods: {
            getList(current_page,page_size){
                this.$store.dispatch('loadCurrentPageSize',page_size);
                var send_data={
                    current_page:current_page,
                    page_size:page_size,
                    lt_bar_code:this.lt_bar_code
                }
                let that=this;
                getLogList(send_data).then(function(response){
                    if(response.data.code==1){
                      that.loglist=response.data.list;
                      that.total_count=response.data.total_count;
                    }
                });
            },
            search(){
               this.getList(1,this.$store.getters.getCurrentPageSize);
            },
        },
        created() {
            this.getList(1,this.$store.state.default_page_size);
        },
    }
</script>
